home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / host contacted / jikes.lha / jikes-1.11 / src / tab.cpp < prev    next >
C/C++ Source or Header  |  1999-07-06  |  931b  |  35 lines

  1. // $Id: tab.cpp,v 1.2 1999/07/06 13:49:25 shields Exp $
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler
  4. // License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1999, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10. #include "tab.h"
  11.  
  12. int Tab::tab_size = Tab::DEFAULT_TAB_SIZE;
  13.  
  14. //
  15. // Compute the length of a wide character string segment
  16. // after expanding tabs.
  17. //
  18. int Tab::Wcslen(wchar_t *line, int start, int end)
  19. {
  20.     for (int i = start--; i <= end; i++)
  21.     {
  22.         if (line[i] == U_HORIZONTAL_TAB)
  23.         {
  24.             int offset = (i - start) - 1;
  25.             start -= ((tab_size - 1) - offset % tab_size);
  26.         }
  27.         else if (Coutput.ExpandWchar() && line[i] > 0xFF)
  28.              start -= 5;
  29.     }
  30.  
  31.     return (end - start);
  32. }
  33.  
  34.  
  35.